package test;

import jm.JMC;
import jm.music.data.Note;
import jm.music.data.Part;
import jm.music.data.Phrase;
import jm.music.data.Score;
import jm.music.tools.Mod;
import jm.util.Play;
import jm.util.View;

public class DrumTest001 implements JMC{

	public static void main(String[] args) {
		Score  score = new Score("鼓乐谱");
		
		Part part1 = new Part("鼓声部1",0,9);//最后一个参数 9---channel 10表示打击乐(此时，第二个参数是什么无所谓)
		
		Phrase phrase1 = new Phrase("乐节1",0.0);
		
//		double[] rhythms1 = { 0.5, 0.25, 0.125,0.125, 0.125, 0.125, 0.125  };
//		double[] rhythms2 = { 0.5, 0.5, 0.5,0.25, 0.125, 0.125, 0.125  };
		double[] rhythms1 = { 1, 1, 0.5,0.5, 0.5, 0.5, 0.25,0.25,0.25,0.25, 0.25,0.25,0.25,0.25, 
				0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125,
				0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125,};
		double[] rhythms2 = { 0.2,0.8, 0.2, 0.8,0.2,0.2,0.6, 0.2,0.2,0.6, 0.2,0.2,0.2,0.8, 0.2,0.2,0.2,0.6, 0.2  };
		for(int i=0; i<rhythms1.length; i++) {
			Note note1 = new Note(38, rhythms1[i]);
			phrase1.add(note1);
		}
		phrase1.add(new Note(46,0.5));// 小立釵
		phrase1.add(new Note(REST,2));//每一乐节后，休止1/4音符
		
//		for(int i=0; i<rhythms2.length; i++) {
//			Note note1 = new Note(38, rhythms2[i]);
//			phrase1.add(note1);
//		}
//		phrase1.add(new Note(46,0.5));//每一乐节后，休止1/4音符
		
		Mod.repeat(phrase1, 10);
		
		part1.add(phrase1);
		score.add(part1);
		
		View.show(score);
		Play.midi(score);
	

	}

}
